<div class="page-title">
    <h1><?php echo $this->__('Edit Account Information') ?></h1>
</div>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate">
    <div class="block">
        <div class="block-title">
            <strong><span><?php echo $this->__('Account Information') ?></span></strong>
        </div>
        <div class="block-content">
            <?php echo $this->getBlockHtml('formkey')?>
            <ul class="form-list">
                <li class="fields">
                    <?php echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
                </li>
                <li class="wide">
                    <div class="input-box">
                        <input type="text" name="email" id="email" value="<?php echo $this->htmlEscape($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" placeholder="<?php echo $this->__('Email Address') ?> *"/>
                    </div>
                </li>
            <?php $_dob = $this->getLayout()->createBlock('customer/widget_dob') ?>
            <?php if ($_dob->isEnabled()): ?>
                <li><?php echo $_dob->setDate($this->getCustomer()->getDob())->toHtml() ?></li>
            <?php endif ?>
            <?php $_taxvat = $this->getLayout()->createBlock('customer/widget_taxvat') ?>
            <?php if ($_taxvat->isEnabled()): ?>
                <li><?php echo $_taxvat->setTaxvat($this->getCustomer()->getTaxvat())->toHtml() ?></li>
            <?php endif ?>
            <?php $_gender = $this->getLayout()->createBlock('customer/widget_gender') ?>
            <?php if ($_gender->isEnabled()): ?>
                <li><?php echo $_gender->setGender($this->getCustomer()->getGender())->toHtml() ?></li>
            <?php endif ?>
                <li class="control">
                    <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo $this->__('Change Password') ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('Change Password') ?></label>
                </li>
            </ul>
        </div>
    </div>
    
    <div class="block" style="display: none;">
        <div class="block-title">
            <strong><span><?php echo $this->__('Change Password') ?></span></strong>
        </div>
        <div class="block-content">
            <ul class="form-list">
                <li class="wide">
                    <div class="input-box">
                        <input type="password" title="<?php echo $this->__('Current Password') ?>" class="input-text" name="current_password" id="current_password" placeholder="<?php echo $this->__('Current Password') ?> *" />
                    </div>
                </li>
                <li class="fields">
                    <div class="field">
                        <div class="input-box">
                            <input type="password" title="<?php echo $this->__('New Password') ?>" class="input-text validate-password" name="password" id="password" placeholder="<?php echo $this->__('New Password') ?> *" />
                        </div>
                    </div>
                    <div class="field">
                        <div class="input-box">
                            <input type="password" title="<?php echo $this->__('Confirm New Password') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" placeholder="<?php echo $this->__('Confirm New Password') ?> *" />
                        </div>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <div class="buttons-set">
        <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
        <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
    </div>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('form-validate', true);
    function setPasswordForm(arg){
        if(arg){
            $('current_password').up(4).show();
            $('current_password').addClassName('required-entry');
            $('password').addClassName('required-entry');
            $('confirmation').addClassName('required-entry');

        }else{
            $('current_password').up(4).hide();
            $('current_password').removeClassName('required-entry');
            $('password').removeClassName('required-entry');
            $('confirmation').removeClassName('required-entry');
        }
    }
    <?php if($this->getCustomer()->getChangePassword()): ?>
        setPasswordForm(true);
    <?php endif; ?>
//]]>
</script>
